// ******************************************************************************
// Copyright     :  Copyright (C) 2020, Hisilicon Technologies Co. Ltd.
// File name     :  ring_cnb_c_union_define.h
// Project line  :
// Department    :
// Author        :  xxx
// Version       :  1.0
// Date          :
// Description   :  xxx
// Others        :  Generated automatically by nManager V5.1
// History       :  xxx 2020/10/23 11:46:44 Create file
// ******************************************************************************

#ifndef RING_CNB_C_UNION_DEFINE_H
#define RING_CNB_C_UNION_DEFINE_H

/* Define the union csr_cnb_version_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 cnb_version : 32; /* [31:0] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_version_u;

/* Define the union csr_cnb_tmout_cnt_thd_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 rp_tmout_cnt_thd : 32; /* [31:0] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_tmout_cnt_thd_u;

/* Define the union csr_cnb_empty_addr_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 ctp : 26; /* [25:0] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_empty_addr_u;

/* Define the union csr_cnb_api_err_flit_cnt_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 cnb_api_err_flit_cnt : 32; /* [31:0] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_api_err_flit_cnt_u;

/* Define the union csr_cnb_api_crt_msge_cnt_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 cnb_api_crt_msge_cnt : 32; /* [31:0] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_api_crt_msge_cnt_u;

/* Define the union csr_cnb_api_tx_msge_cnt_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 cnb_api_tx_msge_cnt : 32; /* [31:0] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_api_tx_msge_cnt_u;

/* Define the union csr_cnb_int_vector_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 cpi_int_index : 24; /* [23:0] */
        u32 rsv_0 : 3;          /* [26:24] */
        u32 enable : 1;         /* [27] */
        u32 int_issue : 1;      /* [28] */
        u32 rsv_1 : 3;          /* [31:29] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_int_vector_u;

/* Define the union csr_cnb_int_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 int_data : 6;        /* [5:0] */
        u32 rsv_2 : 10;          /* [15:6] */
        u32 program_csr_id : 16; /* [31:16] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_int_u;

/* Define the union csr_cnb_int_mask_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 err_mask : 6;        /* [5:0] */
        u32 rsv_3 : 10;          /* [15:6] */
        u32 program_csr_id : 16; /* [31:16] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_int_mask_u;

/* Define the union csr_cnb_api_op_code_err_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 error_bit : 1;       /* [0] */
        u32 multi_error_bit : 1; /* [1] */
        u32 sticky : 30;         /* [31:2] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_api_op_code_err_u;

/* Define the union csr_cnb_csr_cmd_parity_err_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 error_bit : 1;       /* [0] */
        u32 multi_error_bit : 1; /* [1] */
        u32 sticky : 30;         /* [31:2] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_csr_cmd_parity_err_u;

/* Define the union csr_cnb_csr_wr_err_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 error_bit : 1;       /* [0] */
        u32 multi_error_bit : 1; /* [1] */
        u32 sticky : 30;         /* [31:2] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_csr_wr_err_u;

/* Define the union csr_cnb_csr_rddat_parity_err_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 error_bit : 1;       /* [0] */
        u32 multi_error_bit : 1; /* [1] */
        u32 sticky : 30;         /* [31:2] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_csr_rddat_parity_err_u;

/* Define the union csr_cnb_csr_rd_err_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 error_bit : 1;       /* [0] */
        u32 multi_error_bit : 1; /* [1] */
        u32 sticky : 30;         /* [31:2] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_csr_rd_err_u;

/* Define the union csr_cnb_merr_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 cnb_tmout_cnt_ovf_err : 1;  /* [0] */
        u32 cnb_tmout_cnt_ovf_merr : 1; /* [1] */
        u32 cnb_int_parity_err : 1;     /* [2] */
        u32 cnb_int_parity_merr : 1;    /* [3] */
        u32 cnb_api_e1_err : 1;         /* [4] */
        u32 cnb_api_e1_merr : 1;        /* [5] */
        u32 cnb_api_e0_err : 1;         /* [6] */
        u32 cnb_api_e0_merr : 1;        /* [7] */
        u32 cnb_api_token_err : 1;      /* [8] */
        u32 cnb_api_token_merr : 1;     /* [9] */
        u32 cnb_api_protocol_err : 1;   /* [10] */
        u32 cnb_api_protocol_merr : 1;  /* [11] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_merr_u;

/* Define the union csr_cnb_merr_mask_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 cnb_tmout_cnt_ovf_err_mask : 1; /* [0] */
        u32 cnb_int_parity_err_mask : 1;    /* [1] */
        u32 cnb_api_e1_err_mask : 1;        /* [2] */
        u32 cnb_api_e0_err_mask : 1;        /* [3] */
        u32 cnb_api_token_err_mask : 1;     /* [4] */
        u32 cnb_api_procotol_err_mask : 1;  /* [5] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_merr_mask_u;

/* Define the union csr_rs_nd_pe_crdt_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 sta : 10; /* [9:0] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_rs_nd_pe_crdt_u;


// ==============================================================================
/* Define the global struct */
typedef struct {
    volatile csr_cnb_version_u cnb_version;                           /* 0 */
    volatile csr_cnb_tmout_cnt_thd_u cnb_tmout_cnt_thd;               /* 4 */
    volatile csr_cnb_empty_addr_u cnb_empty_addr;                     /* 8 */
    volatile csr_cnb_api_err_flit_cnt_u cnb_api_err_flit_cnt;         /* C */
    volatile csr_cnb_api_crt_msge_cnt_u cnb_api_crt_msge_cnt;         /* 10 */
    volatile csr_cnb_api_tx_msge_cnt_u cnb_api_tx_msge_cnt;           /* 14 */
    volatile csr_cnb_int_vector_u cnb_int_vector;                     /* 18 */
    volatile csr_cnb_int_u cnb_int;                                   /* 1C */
    volatile csr_cnb_int_mask_u cnb_int_mask;                         /* 20 */
    volatile csr_cnb_api_op_code_err_u cnb_api_op_code_err;           /* 24 */
    volatile csr_cnb_csr_cmd_parity_err_u cnb_csr_cmd_parity_err;     /* 28 */
    volatile csr_cnb_csr_wr_err_u cnb_csr_wr_err;                     /* 2C */
    volatile csr_cnb_csr_rddat_parity_err_u cnb_csr_rddat_parity_err; /* 30 */
    volatile csr_cnb_csr_rd_err_u cnb_csr_rd_err;                     /* 34 */
    volatile csr_cnb_merr_u cnb_merr;                                 /* 38 */
    volatile csr_cnb_merr_mask_u cnb_merr_mask;                       /* 3C */
    volatile csr_rs_nd_pe_crdt_u rs_nd_pe_crdt;                       /* 40 */
} S_ring_cnb_csr_REGS_TYPE;

/* Declare the struct pointor of the module ring_cnb_csr */
extern volatile S_ring_cnb_csr_REGS_TYPE *gopring_cnb_csrAllReg;

/* Declare the functions that set the member value */
int iSetCNB_VERSION_cnb_version(unsigned int ucnb_version);
int iSetCNB_TMOUT_CNT_THD_rp_tmout_cnt_thd(unsigned int urp_tmout_cnt_thd);
int iSetCNB_EMPTY_ADDR_ctp(unsigned int uctp);
int iSetCNB_API_ERR_FLIT_CNT_cnb_api_err_flit_cnt(unsigned int ucnb_api_err_flit_cnt);
int iSetCNB_API_CRT_MSGE_CNT_cnb_api_crt_msge_cnt(unsigned int ucnb_api_crt_msge_cnt);
int iSetCNB_API_TX_MSGE_CNT_cnb_api_tx_msge_cnt(unsigned int ucnb_api_tx_msge_cnt);
int iSetCNB_INT_VECTOR_cpi_int_index(unsigned int ucpi_int_index);
int iSetCNB_INT_VECTOR_enable(unsigned int uenable);
int iSetCNB_INT_VECTOR_int_issue(unsigned int uint_issue);
int iSetCNB_INT_int_data(unsigned int uint_data);
int iSetCNB_INT_program_csr_id(unsigned int uprogram_csr_id);
int iSetCNB_INT_MASK_err_mask(unsigned int uerr_mask);
int iSetCNB_INT_MASK_program_csr_id(unsigned int uprogram_csr_id);
int iSetCNB_API_OP_CODE_ERR_error_bit(unsigned int uerror_bit);
int iSetCNB_API_OP_CODE_ERR_multi_error_bit(unsigned int umulti_error_bit);
int iSetCNB_API_OP_CODE_ERR_sticky(unsigned int usticky);
int iSetCNB_CSR_CMD_PARITY_ERR_error_bit(unsigned int uerror_bit);
int iSetCNB_CSR_CMD_PARITY_ERR_multi_error_bit(unsigned int umulti_error_bit);
int iSetCNB_CSR_CMD_PARITY_ERR_sticky(unsigned int usticky);
int iSetCNB_CSR_WR_ERR_error_bit(unsigned int uerror_bit);
int iSetCNB_CSR_WR_ERR_multi_error_bit(unsigned int umulti_error_bit);
int iSetCNB_CSR_WR_ERR_sticky(unsigned int usticky);
int iSetCNB_CSR_RDDAT_PARITY_ERR_error_bit(unsigned int uerror_bit);
int iSetCNB_CSR_RDDAT_PARITY_ERR_multi_error_bit(unsigned int umulti_error_bit);
int iSetCNB_CSR_RDDAT_PARITY_ERR_sticky(unsigned int usticky);
int iSetCNB_CSR_RD_ERR_error_bit(unsigned int uerror_bit);
int iSetCNB_CSR_RD_ERR_multi_error_bit(unsigned int umulti_error_bit);
int iSetCNB_CSR_RD_ERR_sticky(unsigned int usticky);
int iSetCNB_MERR_cnb_tmout_cnt_ovf_err(unsigned int ucnb_tmout_cnt_ovf_err);
int iSetCNB_MERR_cnb_tmout_cnt_ovf_merr(unsigned int ucnb_tmout_cnt_ovf_merr);
int iSetCNB_MERR_cnb_int_parity_err(unsigned int ucnb_int_parity_err);
int iSetCNB_MERR_cnb_int_parity_merr(unsigned int ucnb_int_parity_merr);
int iSetCNB_MERR_cnb_api_e1_err(unsigned int ucnb_api_e1_err);
int iSetCNB_MERR_cnb_api_e1_merr(unsigned int ucnb_api_e1_merr);
int iSetCNB_MERR_cnb_api_e0_err(unsigned int ucnb_api_e0_err);
int iSetCNB_MERR_cnb_api_e0_merr(unsigned int ucnb_api_e0_merr);
int iSetCNB_MERR_cnb_api_token_err(unsigned int ucnb_api_token_err);
int iSetCNB_MERR_cnb_api_token_merr(unsigned int ucnb_api_token_merr);
int iSetCNB_MERR_cnb_api_protocol_err(unsigned int ucnb_api_protocol_err);
int iSetCNB_MERR_cnb_api_protocol_merr(unsigned int ucnb_api_protocol_merr);
int iSetCNB_MERR_MASK_cnb_tmout_cnt_ovf_err_mask(unsigned int ucnb_tmout_cnt_ovf_err_mask);
int iSetCNB_MERR_MASK_cnb_int_parity_err_mask(unsigned int ucnb_int_parity_err_mask);
int iSetCNB_MERR_MASK_cnb_api_e1_err_mask(unsigned int ucnb_api_e1_err_mask);
int iSetCNB_MERR_MASK_cnb_api_e0_err_mask(unsigned int ucnb_api_e0_err_mask);
int iSetCNB_MERR_MASK_cnb_api_token_err_mask(unsigned int ucnb_api_token_err_mask);
int iSetCNB_MERR_MASK_cnb_api_procotol_err_mask(unsigned int ucnb_api_procotol_err_mask);
int iSetRS_ND_PE_CRDT_sta(unsigned int usta);


#endif // RING_CNB_C_UNION_DEFINE_H
